package br.com.future.study.json;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.AnnotationIntrospector;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;

import br.com.future.model.PingResponse;

public class Jackson {
	public static void main(String[] args) throws JsonGenerationException, JsonMappingException, IOException {

		ObjectMapper mapper = new ObjectMapper();

		AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();

		// make deserializer use JAXB annotations (only)
		mapper.getDeserializationConfig().setAnnotationIntrospector(introspector);

		// make serializer use JAXB annotations (only)
		mapper.getSerializationConfig().setAnnotationIntrospector(introspector);
		PingResponse response = new PingResponse();
		//response.setMessage("Red Devil");
		response.setSucceed(true);
		response.setHttpCode(201);
		mapper.writeValue(System.out, response);
	}
}
